package com.mach.platform.controller;

import com.mach.platform.domain.Response;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

/**
 * @author Administrator
 * @Name
 * @Description: 基础的控制器方法
 * @date 2018/4/23 0023   10:57
 */
public abstract class BaseCtrl<T> {

	/**
	 * -- @GetMapping(value = "/info/{id}")
	 * -- @ApiOperation(value = "单个实体信息", notes = "接口备注：无", produces = "application/json")
	 *  单个数据 的接口
	 * -- @PathVariable(value = "id", required = true) Long id
	 *
	 * @param id 数据的id
	 * @return Response
	 */
	public abstract Response info (Long id);

	/**
	 * --	@ApiOperation(value = "列表--分页", produces = "application/json", notes = "列表参数：size(每页数量),page(页码),searchParam(查询内容)")
	 * -- @GetMapping(value = "/list")
	 *    获取列表数据
	 * -- @PageableDefault(size = 25) Pageable pageable
	 * -- @RequestParam Map params
	 *
	 * @param pageable 分页参数
	 * @param params 其他参数
	 * @return Response
	 */
	public abstract Response list (Pageable pageable, Map params);

	/**
	 * -- @DeleteMapping("/del")
	 * -- @ApiOperation(value = "删除", notes = "接口备注：无", produces = "application/json")
	 *    删除数据
	 * -- @RequestBody Long[] ids
	 *
	 * @param ids id的集合
	 * @return Response
	 */
	public abstract Response delete (Long[] ids);

	/**
	 * --@PostMapping("/save")
	 * --	@ApiOperation(value = "保存", notes = "接口备注：无", produces = "application/json")
	 * 保存一个 对象
	 * --@RequestBody T t
	 *
	 * @param t 保存的实体
	 * @return Response
	 */
	public abstract Response save (@RequestBody T t);

	/**
	 * --@PutMapping("/upd")
	 * --	@ApiOperation(value = "更新", notes = "接口备注：无", produces = "application/json")
	 * 更新一个对象
	 * --@RequestBody T t
	 *
	 * @param t 更新的实体
	 * @return Response
	 */
	public abstract Response update (T t);


}
